//
//  HMTabBarViewController.m
//  HeartMark
//
//  Created by rimi on 2016/11/6.
//  Copyright © 2016年 黄华强. All rights reserved.
//

#import "HMTabBarViewController.h"
#import "HMHandwritingViewController.h"
#import "HMLookAndThinkViewController.h"
#import "HMSettingViewController.h"
#import "HMTreasureCollectionController.h"

@interface HMTabBarViewController ()

@end

@implementation HMTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //添加子控制器
    [self addChildController:[HMHandwritingViewController new] title:@"笔迹" imageName:@"biji"];
    [self addChildController:[HMLookAndThinkViewController new] title:@"寻思" imageName:@"pengyouquan"];
    [self addChildController:[HMTreasureCollectionController new] title:@"珍藏" imageName:@"shoucang"];
    [self addChildController:[HMSettingViewController new] title:@"我的" imageName:@"wode"];
    
}



-(void)addChildController:(UIViewController *)childController title:(NSString *)title imageName:(NSString *)imageName {
    
    childController.title = title;
    childController.tabBarItem.title = title;
    
    childController.tabBarItem.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //拼接照片字符串
    NSString* imageHL = [NSString stringWithFormat:@"%@_hl",imageName];
    childController.tabBarItem.selectedImage = [[UIImage imageNamed:imageHL] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
   
    self.tabBar.tintColor = APP_COLOR;
    
    
    UINavigationController *naviVC = [[UINavigationController alloc]initWithRootViewController:childController];
    
    [self addChildViewController:naviVC];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
